package com.study_online.controller;


import com.study_online.domain.ResultInfo;
import com.study_online.service.Impl.SearchServiceImpI;
import com.study_online.service.Impl.UserServiceImpl;
import com.study_online.utils.CheckTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchServiceImpI searchServiceImpI;
    @Resource
    private RedisTemplate<String, Object> redisTemplate;

    /**
     * 首页搜索
     * @param pageNum
     * @param pageSize
     * @param keywords
     * @return
     */
    @RequestMapping("/searchByKeywords")
    @ResponseBody
    public ResultInfo searchByKeywords(int pageNum, int pageSize, String keywords) {

        ResultInfo info = searchServiceImpI.searchKeywordsList(pageNum, pageSize, keywords);
        return info;

    }
}
